<template>
  <div>
    <my-title title="收藏列表"></my-title>
    <house-item
    :rentData="item"
    v-for="item in favoriteList"
    :key="item.houseCode"
    />
  </div>
</template>

<script>
import { getFavoriteList } from '@/api/collect.js'
import { Toast } from 'vant'
import MyTitle from '@/components/MyTitle'
import HouseItem from '@/components/HouseItem'
export default {
  name: 'Collect',
  data () {
    return {
      favoriteList: []
    }
  },
  components: { MyTitle, HouseItem },
  created () {
    this.getFavoriteList()
    Toast.loading({
      duration: 0,
      message: '加载中...',
      forbidClick: true
    })
  },

  methods: {
    async getFavoriteList () {
      try {
        const res = await getFavoriteList()
        // console.log(res)
        if (res.data.status === 200) {
          Toast.clear()
          this.favoriteList = res.data.body
        } else {
          Toast('获取用户信息失败！')
          // Toast(res.data.description)
        }
      } catch (error) {
        console.log(error)
      }
    }
  }
}
</script>

<style scoped lang='less'>

</style>
